package com.dropTables.TakingNote;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

public class NearbySpecActivity extends Activity 
{
	private TextView loc;
	private TextView dist;
	private Button rem;
	private Long id;
	private String name = "You fucked up.";
	private double distance = 0;
	public static String KEY_SPEC_NAME = "key_name";
	public static String KEY_SPEC_DIST = "key_distance";
	public static String KEY_SPEC_ID = "key_id";
	
	@Override
	public void onCreate(Bundle savedInstanceState)
	{
		super.onCreate(savedInstanceState);
		setContentView(R.layout.near_spec);
		loc = (TextView) findViewById(R.id.near_loc_text);
		dist = (TextView) findViewById(R.id.near_loc_dist);
		rem = (Button) findViewById(R.id.rem_spec_reminder_button);
		
		Intent thisIntent = getIntent();
		
		
		Bundle extras = thisIntent.getExtras();
		if(extras != null)
		{
			name = extras.getString(KEY_SPEC_NAME);						//Get name and distance to display
			distance = extras.getDouble(KEY_SPEC_DIST);
		}
		
		loc.setText(name);
		dist.setText(Integer.toString((int) distance));
		
		rem.setOnClickListener(new View.OnClickListener() 
		{
			
			@Override
			public void onClick(View v) 
			{
				removeReminder();
			}
		});
	}
	
	/*
	 * A function to tell the service to stop reminding
	 * 
	 */
	private void removeReminder()
	{
		SecificLocService.removeReminder(id);
		finish();
	}

}
